package com.linsen.erp.admin.provider.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

//婚姻状态
@Getter
@AllArgsConstructor
public enum MaritalEnum {
    UNMARRIED(1,"未婚"),
    MARRIED(2,"已婚"),
    DIVORCE(3,"离异"),
    ;

    @JsonValue
    private final Integer value;
    private final String desc;

    private static final Map<Integer, MaritalEnum> VALUES = new HashMap<>();

    static {
        for (final MaritalEnum registerTypeEnum : MaritalEnum.values()) {
            MaritalEnum.VALUES.put(registerTypeEnum.getValue(), registerTypeEnum);
        }
    }

    @JsonCreator
    public static MaritalEnum getByValue(Integer value) {
        return MaritalEnum.VALUES.get(value);
    }
}
